package com.xujiang.mytool.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.xujiang.common_adapter.base.IBaseAdapter;
import com.xujiang.common_adapter.core.RecyclerViewHelper;
import com.xujiang.common_core.util.ui.UIUtils;
import com.xujiang.common_plus.ui.CPRxBaseActivity;
import com.xujiang.common_style.ButtonDemo;
import com.xujiang.mytool.R;
import com.xujiang.mytool.adapter.StyleTestAdapter;

import java.util.Arrays;
import java.util.List;

/**
 * @author xujiang
 * @version 2017-07-24 16:23
 */
public class StyleTestActivity extends CPRxBaseActivity {

    RecyclerViewHelper mRecyclerViewHelper;
    private StyleTestAdapter styleTestAdapter;
    private List<String> list;
    String[] string = { "ButtonStyle" };

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_style_test);
        styleTestAdapter = new StyleTestAdapter(getActivity());
        list = Arrays.asList(string);
        styleTestAdapter.setList(list);
        mRecyclerViewHelper = RecyclerViewHelper.newBuilder(getActivity())
                .setAdapter(styleTestAdapter)
                .enableHorizontalDividerLineResId(R.color.color_cc)
                .setOnItemClickListener(new IBaseAdapter.OnItemClickListener<String>() {
                    @Override
                    public void onItemClick(String item, View view, int position) {
                        Click(item, view, position);
                    }
                })

                .build();
    }

    private void Click(String item, View view, int position) {
        switch (position) {
            case 0:
                UIUtils.startActivity(getActivity(), ButtonDemo.class);
                break;
        }
    }
}
